﻿@using WineStore.Extends;
@using PagedList.Mvc;
@using PagedList;
@model PagedList.IPagedList<WineStore.Models.Customer>
@{
    ViewBag.Title = "ShowCustomer";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}
@section Styles
{
    <!--Sử dụng cho paging-->
    <link href="../../Content/PagedList.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        td {
            text-align: center;
            vertical-align: middle;
        }
    </style>
}
@section Scripts
{
    <!--Sử dụng cho row hover-->
    <script type="text/javascript">
        $(document).ready(function () {
            $("tr").not(':first').hover(function () {
                $(this).css("background", "#F0FFFF");
            }, function () {
                $(this).css("background", "");
            }
            );
        });
    </script>

}
<!-- Table (TABLE) -->
@if (Session["Admin"] != null)
{
    <h3 class="tit">Management Customer
    </h3>
    using (Html.BeginForm())
    {
    <table border="1" style="width:100%">
        <tr>
            <th>FullName
            </th>
            <th>Address
            </th>
            <th>Phone
            </th>
            <th>Email
            </th>
            <th>Event
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(customer => item.FullName)
                </td>
                <td>
                    @Html.DisplayFor(customer => item.Address)
                </td>
                <td>
                    @Html.DisplayFor(customer => item.Phone)
                </td>
                <td>
                    @Html.DisplayFor(customer => item.Email)
                </td>
                <td>
                    @Html.ActionLink("Delete", "DeleteCustomer", new { id = item.CustomerId })
                </td>
            </tr>
        }
    </table>
    <!--Paging-->
    @Html.PagedListPager(Model, page => Url.Action("ShowCustomer", new { page = page}), (PagedListRenderOptions)ViewBag.Pro)
    }
}
else
{
    Response.Redirect("~/Admin/LogOn/");
}